home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
fc20.zip
/
FC.DOC
next >
Wrap
Text File
|
1990-03-21
|
28KB
|
592 lines
FC Ver. 2.0
Mike Albert
Copyright (c) 1990
1 INTRODUCTION
FC compares two text files and lists the differences between them line
by line. FC provides the following benefits:
o FC can show word by word differences between lines that have
changed.
o FC helps "C" programmers merge program changes. FC can compare
two "C" programs containing separate sets of changes, and
combine them automatically to make a single program.
o FC lets you do multiple comparisons in one run.
o FC can ignore white space changes. This is useful when you want
to ignore format changes in "C" programs or other text.
o FC never gets confused or "unsynchronized" (as some comparison
programs can).
o FC always finds the smallest set of differences between files,
and never misses matching lines.
o FC lets you list changes in ways that make sense to you by
providing multiple display options. You can also customize FC
to use your favorite options automatically.
If you're familiar with earlier versions of FC, look at section 7 to
learn about the enhancements.
FC can be used on any IBM-compatible computer. Any display adapter that
provides 25 lines of 80 characters will work correctly. FC runs under
MS-DOS versions 2.0 and later, but 3.0 or later is required to customize
the default options. The amount of memory required is dependent on file
size. 100K is enough for small files, while up to 425K is needed for
large ones. Files containing up to 16,300 lines can be compared.
2 OPERATION
To list the differences between two ASCII text files line by line:
fc file1 file2 options
Changes to file1 to make file2 are listed. Wild-card characters can be
used to do multiple comparisons. The options are:
-a list all lines (whether different or the same)
-s list only lines that are the same
-w ignore white space differences in lines when comparing
-b don't list redundant blank lines
-f list using an alternate format that's useful for editing
-m merge two C programs
-c<n> show context for changes - list up to <n> unchanged
lines as changed when that's clearer - default <n> is 1
-d<n> show differences between changed lines word by word -
<n> = 1 shows minor differences, 10 shows all - default
<n> is 5
-t<n> tab interval is <n> characters - default interval is 8
-u update default options, -u- clears old defaults first
>file3 put difference listing in file file3
A default option can be turned off with a minus sign, e.g. -m- turns off
the -m option. You can also make an option affect only screen output or
file output - an "s" after the option letter indicates screen output,
while "f" indicates file output. E.g. -ds5 specifies that the -d5
option is used for screen output, but doesn't affect output to a file.
This feature is useful when updating default options (with the -u
option), because you often want different options for the two output
devices.
The following examples illustrate the use of FC:
Compare two files in the current directory and display the
differences on the screen:
fc prog1.asc prog2.asc
Compare two files in different directories and drives, list all
lines using the alternate listing format (ignoring white space
differences when comparing), and put the difference listing in file
prog2.dif:
fc d:\backup\prog1.asc c:\tc\prog2.asc -a -w >prog2.dif
Compare two files with the same names in different directories and
drives, and display the differences using the alternate listing
format:
fc -f d:\backup\prog1.asc c:\tc
Compare all files with ".c" extensions and the same names in two
different directories:
fc \backup\*.c \tc\*.*
Merge two "C" programs to make a single combined program:
fc dbupdat1.c dbupdat2.c -m >dbupdat3.c
Change the default options for future invocations of FC to -w -c -b
for output to either output device, and -d5 for output to the
screen:
fc -u- -w -c -b -ds5
Turn off the -w default option (which was previously set) for output
to a file, but leave it on for screen output:
fc -u -wf-
3 DETAILED OPERATION
The arguments to FC (files and options) can be supplied in any order.
The options work as follows:
-a All - FC normally lists only the lines that differ between
the two files. With the -a option, matching lines are also
listed.
-s Same - With the -s option, only matching lines are listed.
-w White space - FC normally lists lines as different if any
character in the line (except trailing white space) is
different. With this option, differences in embedded white
space (i.e. space and tab characters) are ignored. This is
useful when you want to ignore differences in the layout of
programs or documents. FC knows about "C" language syntax,
so that only white space that is ignored by a "C" compiler
is ignored by FC.
-b Blanks - FC normally lists all lines that have changed.
With this option, redundant blank lines (i.e. more than one
blank line in a row, or blank lines leading or trailing a
group of changes) aren't shown.
-f Format - This option directs FC to list changes using a
different format that doesn't indent, and shows the line
numbers of changes in both files. This format is useful
when directing the listing to a file used to re-create
changes.
-m Merge format - FC merges two "C" programs into a single
program when this option is used. The new file can be
compiled as the first program, the second program, or the
combination of the two. When you #define the symbol
FC_FILE_1, lines present in the first file are included.
FC_FILE_2 does the same thing for the second file. If you
specify both #define's, lines from both programs are
included. This feature is particularly useful when
combining two separate sets of changes to a program. You
merge the two changed programs, examine the combined
program, and remove the #ifdefs to complete the merge. In
most cases the #ifdefs can be removed without incident.
Where there are conflicts between the two sets of changes,
you can resolve them as needed. If you feel brave, you can
compile the merged program with both #define's specified and
see if it works. The merge does not always produce a
compilable program - if the changes involve comments,
#ifdef's, or multiline #defines, the #ifdef's inserted can
conflict with them.
-c<n> Context - When this option is used, FC shows context
surrounding changes to make the listing more readable. This
is done